package com.yiren.backstage.communication.interfaces;
/**
 * Time:2021/1/21 14:45
 * Author:xiaozan
 * Description:设备连接通讯数据 回调
 */
public abstract class DataCallback {

    protected String readData;  //通讯获取的数据


    protected String name;
    protected DataCallback nextCallback;

    public DataCallback(String name, DataCallback nextCallback) {
        this.name = name;
        this.nextCallback = nextCallback;
    }

    public DataCallback(){}

    /**
     * 设置参数
     * @param key
     * @param obj
     */
    public void setParam(String key, Object obj) {

    }

    /**
     * 通过key获取参数
     * @param key
     * @return
     */
    public Object getParam(String key) {
        return null;
    }

    /**
     * 通讯连接状态
     * @param state 状态码
     * @param message 中文提示
     */
    public void onStateChange(int state, String message) {

    }


    /**
     * 读取通讯数据
     * @param data 返回String的数据
     */
    public void onReadData(String data) {
        setReadData(data);
    }

    /**
     * 发送指令 回复数据
     * @param data
     */
    public void onSendReadData(String data){

    }

    public String getReadData() {
        return readData;
    }

    public void setReadData(String readData) {
        this.readData = readData;
    }
}
